# -*- coding: utf-8 -*-

import json,sys
from multiprocessing import Process

from PyQt4 import QtGui

from business_top.auto_main_engine import auto_main_engine as MainEngine
from uiBasicWidget import BASIC_FONT
from uiMainWindow import MainWindow

class ui_process(Process):
	def run(self):
		app=QtGui.QApplication(sys.argv)
		app.setWindowIcon(QtGui.QIcon('vnpy.ico'))
		app.setFont(BASIC_FONT)
		
		# 设置Qt的皮肤
		try:
			f=file("VT_setting.json")
			setting=json.load(f)
			if setting['darkStyle']:
				import qdarkstyle
				app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
		except:
			pass
		
		# 初始化主引擎和主窗口对象
		
		mainEngine=MainEngine()
		mainWindow=MainWindow(mainEngine, mainEngine.eventEngine)
		mainWindow.showMaximized()
		app.exec_()
		pass
	
	def __init__(self):
		super(ui_process, self).__init__()
		self.start()
	pass